/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */

function SetCookie(name,value,expires)
{
  if (!expires) expires = new Date();
  document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() + ";path=/";
}

function GetCookie(name)
{
  var dcookie = document.cookie;
  var cname =  name + "=";
  var clen = dcookie.length;
  var cbegin = 0;
  while (cbegin < clen)
  {
    var vbegin = cbegin + cname.length;
    if (dcookie.substring(cbegin, vbegin) == cname)
    {
      var vend = dcookie.indexOf(";",vbegin);
      if (vend == -1) vend = clen;
        return unescape(dcookie.substring(vbegin,vend));
    }
    cbegin = dcookie.indexOf(" ",cbegin) + 1;
    if (cbegin == 0) break;
  }
  return null;
}

function DelCookie(name)
{
  var expireNow = new Date();
  document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}